package PrimAndKruskal;

public class Sort {
    public static void quick(int left,int right,Edge arr[]){
        int r=right;
        int l=left;
        int middle=left;
        int pivot=arr[middle].weigh;
        while(l<r){
            while(arr[l].weigh<pivot){
                l++;
            }
            while(arr[r].weigh>pivot){
                r--;
            }
            Edge temp=arr[l];
            arr[l]=arr[r];
            arr[r]=temp;
            if(l>=r){
                break;
            }
            if(arr[l].weigh==pivot){
                r--;
            }
            if(arr[r].weigh==pivot){
                l++;
            }
        }
        if(l==r){
            l++;
            r--;
        }
        if(l<right){
            quick(l,right,arr);
        }
        if(r>left){
            quick(left,r,arr);
        }
    }
}
